import request from '@/service/lib/request';
import hiSetting from '@/hiSetting'

//查询标签列表
export function getTagList(data) {
    return request({
        url: hiSetting.server + "/tagApi/list",
        method: 'get',
        params: data,

    });
}
//查询单个标签
export function getTag(recordId) {
    return request({
        url: hiSetting.server + "/tagApi/get",
        method: 'get',
        params: { recordId },

    });
}
//新增标签
export function addTag(data) {
    return request({
        url: hiSetting.server + "/tagApi/add",
        method: 'post',
        data,
        transformRequest: [
            function (data) {
                let ret = ''
                for (let it in data) {
                    ret += encodeURIComponent(it) + '=' + encodeURIComponent(data[it]) + '&'
                }
                ret = ret.substring(0, ret.lastIndexOf('&'));
                return ret
            }
        ],
        headers: {
            'Content-Type': 'application/x-www-form-urlencoded'
        }
    });
}
//修改标签
export function modifyTag(data) {
    return request({
        url: hiSetting.server + "/tagApi/modify",
        method: 'post',
        data,
        transformRequest: [
            function (data) {
                let ret = ''
                for (let it in data) {
                    ret += encodeURIComponent(it) + '=' + encodeURIComponent(data[it]) + '&'
                }
                ret = ret.substring(0, ret.lastIndexOf('&'));
                return ret
            }
        ],
        headers: {
            'Content-Type': 'application/x-www-form-urlencoded'
        }
    });
}
//删除标签
export function removeTag(data) {
    return request({
        url: hiSetting.server + "/tagApi/remove",
        method: 'post',
        data,
        transformRequest: [
            function (data) {
                let ret = ''
                for (let it in data) {
                    ret += encodeURIComponent(it) + '=' + encodeURIComponent(data[it]) + '&'
                }
                ret = ret.substring(0, ret.lastIndexOf('&'));
                return ret
            }
        ],
        headers: {
            'Content-Type': 'application/x-www-form-urlencoded'
        }
    });
}

//用户标签绑定
export function userTagBind(data) {
    return request({
        url: hiSetting.server + "/userTagApi/bind",
        method: 'post',
        data

    });
}
//用户标签解绑 
export function userTagUnbind(data) {
    return request({
        url: hiSetting.server + "/userTagApi/unbind",
        method: 'post',
        data

    });
}
//查询用户个人标签
export function getPersonalTag(data) {
    return request({
        url: hiSetting.server + "/userTagApi/personaltaglist",
        method: 'get',
        params: data,

    });
}
//查询用户团队标签
export function getUserGroup(data) {
    return request({
        url: hiSetting.server + "/userTagApi/usergrouplist",
        method: 'get',
        params: data,

    });
}